package com.ricchieri.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.springframework.cache.annotation.Cacheable;

import com.ricchieri.dao.interf.IExpenseTypeDao;
import com.ricchieri.filter.BasicFilter;
import com.ricchieri.model.ExpenseType;

public class ExpenseTypeDao extends GenericDao implements IExpenseTypeDao {
	private static final long serialVersionUID = 1639465882071095940L;

	@SuppressWarnings("unchecked")
	@Override
	@Cacheable(value="expenseType")
	public List<ExpenseType> getAllExpenseType(BasicFilter filter) {
		Criteria criteria = criteriaAllExpenseType(filter);
		
		return criteria.list();
	}
	
	private Criteria criteriaAllExpenseType(BasicFilter filter) {
		return super.criteriaAllBasic(filter, ExpenseType.class);
	}	
	
	@Override
	protected String getTableName() {
		return "expenseType";
	}
}